package com.haddonhillgroup.sample.rest;

import org.beaconframework.util.DomUtil;
import org.w3c.dom.Document;

import com.sun.jersey.api.client.WebResource;
import com.sun.jersey.api.client.config.DefaultClientConfig;

public class TwitterSearchClient {
	private WebResource getRoot() {
		DefaultClientConfig cc = new DefaultClientConfig();

		com.sun.jersey.api.client.Client c = com.sun.jersey.api.client.Client
				.create(cc);
		return c.resource("http://search.twitter.com");

	}

	public void printSearch(String q) {
		DomUtil.prettyPrint(System.out, (Document) getRoot()
				.path("search.atom").queryParam("q", q).get(Document.class));
	}
}
